<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            box-sizing: border-box;
            height: 200px;
            width: 200px;
            border: 10px solid red;
            
            overflow: auto;
        }
    </style>
</head>

<body>
    <div>内容dgsfkgdkfsdfk开始lkljkljkljljkljkljkljkljljkljkl发噶客发发嘎嘎电视广告风格豆腐干豆腐干大概的户是fsdfsdfasdfasdfsf的功放开关撒点胡椒粉关于爱看书的话费卡公司电话发给是客户的广泛教科书的规范化卡</div>
    <script>
        var div = document.querySelector('div');
        div.addEventListener('scroll',function(){
            console.log(div.scrollTop);         
        })
    </script>
</body>

</html>